<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@include file="/WEB-INF/jsp/common/constant.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${path}">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="RES/ui/easyui-1.3.6/themes/bootstrap/easyui.css">
<link type="text/css" rel="stylesheet" href="RES/ui/easyui-1.3.6/themes/icon.css">
<link type="text/css" rel="stylesheet" href="RES/skins/default/css/default.css">
<script src="RES/js/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="RES/ui/easyui-1.3.6/jquery.easyui.min.js" type="text/javascript"></script>
<script src="RES/js/m.js" type="text/javascript"></script>
<script type="text/javascript" src="RES/ui/easyui-1.3.6/locale/easyui-lang-zh_CN.js"></script>
<title>系统首页</title>
<script type="text/javascript">
$(document).ready(function(){
	$.custom.treeTask({
		url:'system/menu/list.do',
		callback:createMenu
	});
})
function createMenu(data) {
	var isSelected = true;
	for(var i in data) {
		var html = '<ul>';
		if(data[i].children!=null && data[i].children!=undefined) {
			for(var j in data[i].children) {
				html += "<li><a href=\"javascript:openTab("+data[i].children[j].id+",'"+data[i].children[j].name+"','"+data[i].children[j].url+"')\">"+data[i].children[j].name+"</a></li>";
			}
		}
		html += '</ul>';
		$('#treeMenu').accordion('add', {
			title: data[i].name,
			content: html,
			selected: isSelected
		});
		isSelected = false;
	}
}
function openTab(id,title,href) {
	if ($('#mainTabs').tabs('exists',title)){
		$('#mainTabs').tabs('select', title);
	} else {
		$('#mainTabs').tabs('add',{
		    title:title,
		   	//content:'<iframe frameborder=0 style="width:100%;height:100%" src="'+href+'"></iframe>',
		   	href:href,
		    closable:true,
		    tools:[{
		        iconCls:'icon-mini-refresh',
		        handler:function(){
		        	
		        }
		    }]
		});
	}
}
</script>
<style type="text/css">
body {
	padding: 0;
	margin: 0;
}
.left_menu_node {
	font-size:12px;
	border-bottom:1px solid gray;;
	text-align:center;
	height:30px;
	line-height:30px;
}
.left_menu_node:hover {
	background-color:yellow;
}
.left_menu_node a {
	color:black;
	text-decoration:none;
}
</style>
</head>
<body class="easyui-layout">
	<div data-options="region:'north',border:false" style="height: 60px; background: #B3DFDA; padding: 10px">
		欢迎${sessionScope.sys_session_user.username }
	</div>
	<div data-options="region:'west',split:true" style="width: 200px;">
		<div class="easyui-accordion" data-options="fit:true" id="treeMenu"></div>
	</div>
	<div data-options="region:'center'" id="mainTabs" class="easyui-tabs">
		<div title="首页">
			这里是首页
    	</div>
	</div>
</body>
</html>